package com.demo2do.jit.injection.module;

import android.content.Context;

import com.demo2do.jit.JitApplication;
import com.demo2do.jit.R;
import com.demo2do.jit.injection.qualifier.ApplicationContext;

import javax.inject.Named;
import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

/**
 * Provide application-level dependencies.
 */
@Module
public class ApplicationModule {

    protected JitApplication mJitApplication;

    public ApplicationModule(JitApplication jitApplication) {
        mJitApplication = jitApplication;
    }

    @Provides
    JitApplication provideApplication() {
        return mJitApplication;
    }

    @Provides
    @Singleton
    @ApplicationContext
    Context provideContext() {
        return mJitApplication;
    }

    @Provides
    @Singleton
    @Named("app_server")
    String provideAppServer(JitApplication app) {
        return app.getString(R.string.app_server);
    }

}
